/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package aic.lists;

import aic.beans.Order;
import aic.misc.DebugPrint;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class OrderList {

    private static List<Order> orderList = Collections.synchronizedList(new LinkedList<Order>());

    public static boolean add(Order order) {
        DebugPrint.println("adding Order: "+order);
        return orderList.add(order);
    }

    public static boolean contains(Order order) {
        boolean ret = orderList.contains(order);
        DebugPrint.println("Order "+order+" is in the list: "+ret);
        printList();
        return orderList.contains(order);
    }

    /**
     * Prints out a list of all Orders within "orderList"
     */
    public static void printList() {
        Iterator it = orderList.iterator();

        while (it.hasNext()) {
            System.out.println(">>list value (orderList): " + it.next());
        }
    }

}
